package ru.ncedu.java.vlku.hrs.uil.cmd;

import ru.ncedu.java.vlku.hrs.bll.HRSManager;
import ru.ncedu.java.vlku.hrs.bll.HRSManagerFactory;
import ru.ncedu.java.vlku.hrs.model.Cargo;

import java.util.List;

public class GetAllCargos implements Command {
    // getall cargo
    @Override
    public void execute(String[] args) {
        if (args.length != 2)
            throw new IllegalArgumentException();
        HRSManager manager = HRSManagerFactory.getInstance().getHRSManager();
        List<Cargo> cargos = manager.getAllCargos();
        System.out.println("Id\tName\tWeight");
        for (int i = 0; i < cargos.size(); i++)
            System.out.println(cargos.get(i).getId() + "\t" + cargos.get(i).getName() + "\t" + cargos.get(i).getWeight());
    }
}
